package com.bt.dmdb.model;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "ODS_PROP")
@SuppressWarnings("serial")
public class Prop implements java.io.Serializable {

    private long id;
    private Project project;
    private String name;
    private Set<PropMilestone> propMilestones = new HashSet<PropMilestone>(0);
    private Set<PropSite> propSites = new HashSet<PropSite>(0);

    public Prop() {
    }

    public Prop(long id, String name) {
        this.id = id;
        this.name = name;
    }

    public Prop(long id, Project project, String name, Set<PropMilestone> propMilestones, Set<PropSite> propSites) {
        this.id = id;
        this.project = project;
        this.name = name;
        this.propMilestones = propMilestones;
        this.propSites = propSites;
    }

    @Id
    @Column(name = "ID", unique = true, nullable = false, precision = 10, scale = 0)
    public long getId() {
        return this.id;
    }

    public void setId(long id) {
        this.id = id;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "PROJECT_ID")
    public Project getProject() {
        return this.project;
    }

    public void setProject(Project project) {
        this.project = project;
    }

    @Column(name = "NAME", nullable = false)
    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "prop")
    public Set<PropMilestone> getPropMilestones() {
        return this.propMilestones;
    }

    public void setPropMilestones(Set<PropMilestone> propMilestones) {
        this.propMilestones = propMilestones;
    }

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "prop")
    public Set<PropSite> getPropSites() {
        return this.propSites;
    }

    public void setPropSites(Set<PropSite> propSites) {
        this.propSites = propSites;
    }
}
